package com.excilys.formation.project.webservices;

import java.util.Set;

import javax.jws.WebService;

import org.springframework.beans.factory.annotation.Autowired;

import com.excilys.formation.project.entities.Client;
import com.excilys.formation.project.entities.Compte;
import com.excilys.formation.project.repository.ClientDAO;

@WebService(endpointInterface = "com.excilys.formation.project.webservices.WebServiceTest")
public class WebServiceTestImpl implements WebServiceTest {

    @Autowired
    ClientDAO clientdao;

    @Override
    public String helloMethod(String s) {

        return ("Hello " + s);
    }

    @Override
    public Set<Compte> getListeComptes(Long clientId) {

        Client connectedClient = clientdao.getClient(clientId);

        Set<Compte> CompteListe = (Set<Compte>) connectedClient.getComptes();
        return CompteListe;
    }
}
